﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Specialized;

namespace Chapter04_Lesson01
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList sl = new SortedList();
            sl.Add("Stack.", "It implements a LIFO.");
            sl.Add("Queue.", "It implements a FIFO.");
            sl.Add("SortedList.", "It implements a structure based on the key/value pair.");

            foreach (DictionaryEntry v in sl)
                Console.WriteLine(v.Key.ToString() + v.Value);

            Console.Read(); 

        }

        class SortMyWay :IComparer 
        {

            #region IComparer Members

            /// <summary>
            /// This compares two objects and maka their ordering decreascing.
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <returns></returns>
            public int Compare(object x, object y)
            {
                return ((new CaseInsensitiveComparer()).Compare(y.ToString(), x.ToString()));
            }

            #endregion
        }
    }
}
